package com.ebupt.migu.music.sms.controller;

import com.ebupt.migu.music.common.entity.MegamarketResultObject;
import com.ebupt.migu.music.common.entity.ResultObject;
import com.ebupt.migu.music.common.exception.StatusEnum;
import com.ebupt.migu.music.sms.enty.SubCompanyCampAuditNotifyParam;
import com.ebupt.migu.music.sms.service.SendToMegamarketService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RequestMapping("/Megamarket")
@RestController
public class SendToMegamarketController {

    @Resource
    private SendToMegamarketService sendToMegamarketService;

    @RequestMapping("/subCompanyCampAuditNotify")
    public MegamarketResultObject subCompanyCampAuditNotify(@Validated @RequestBody SubCompanyCampAuditNotifyParam subCompanyCampAuditNotifyParam){
        try {
                return sendToMegamarketService.subCompanyCampAuditNotify(subCompanyCampAuditNotifyParam);
        }catch (Exception e){
            MegamarketResultObject res = new MegamarketResultObject();
            res.setCode(StatusEnum.ERROR.getCode());
            res.setMessage(e.getMessage());
            return res;
        }
    }

}
